package com.smart.seckilldemo.controller;


import com.smart.seckilldemo.commons.result.ResponseResult;
import com.smart.seckilldemo.service.UserService;
import com.smart.seckilldemo.commons.vo.LoginVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 登陆
 */

@Controller
@RequestMapping("/index")
public class LoginController {

    @Resource
    UserService userService;

    @RequestMapping("/tologin")
    public String toLogin(){
        return "login";
    }


    @ResponseBody
    @RequestMapping("/login")
    public ResponseResult LoginAction(LoginVo loginVo, HttpServletRequest request, HttpServletResponse response){
        return userService.login(loginVo,request,response);
    }


}
